package com.xuesinuo.ots.config.spring;

import com.xuesinuo.ots.config.i18n.I18nTips;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * API返回错误！
 */
@Getter
@Setter
@ToString
public class ApiException extends RuntimeException {
    private String code;
    private I18nTips i18nTips;
    private Object[] i18nTipArgs;
    private Object data;

    public ApiException(String code) {
        this.code = code;
    }

    public ApiException(String code, I18nTips i18nTips, Object... i18nTipArgs) {
        this.code = code;
        this.i18nTips = i18nTips;
        this.i18nTipArgs = i18nTipArgs;
    }

    public ApiException(String code, Object data, I18nTips i18nTips, Object... i18nTipArgs) {
        this.code = code;
        this.data = data;
        this.i18nTips = i18nTips;
        this.i18nTipArgs = i18nTipArgs;
    }
}
